package com.web.jq.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.web.jq.pojo.Comment;

import com.web.jq.service.CommentService;


@CrossOrigin(allowCredentials = "true",allowedHeaders = "*")
@Controller
public class CommentController {
@Autowired
private CommentService commentService;

	@ResponseBody
	@PostMapping("/Comment")
	public int InsertComment(Comment comment) {
		System.out.print(9);
		int i=commentService.InsertComment(comment);
		if (i>0) {
			return i;
		}
		else {
			return i;
		}
		
	}
	@ResponseBody
	@RequestMapping("/List")
	public List<Comment> findList(){
		List<Comment> comments=commentService.findComment();
		return comments;
	}
	
}
